import 'package:flutter/material.dart';

class XdSliverPersistentHeaderDelegate extends SliverPersistentHeaderDelegate {

  final PreferredSize child;

  XdSliverPersistentHeaderDelegate({required this.child});

  @override
  Widget build(
      BuildContext context, double shrinkOffset, bool overlapsContent) {
    return Container(
      // color: Theme.of(context).backgroundColor,
      color: Colors.transparent,
      child: child,
    );
  }

  @override
  double get maxExtent => this.child.preferredSize.height;

  @override
  double get minExtent => this.child.preferredSize.height;

  @override
  bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) {
    return true;
  }
}